<%--
  Created by IntelliJ IDEA.
  User: 沸羊羊
  Date: 2022/11/1
  Time: 14:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>档案登记复核</title>
</head>
<body>
<form id="myFormB">
    <div class="container" style="width: 1210px;height: 600px;border: #EEEEEE solid 1px;background: #EEEEEE">
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: blue">你正在做的业务：产品设计--产品档案管理--产品档案登记复核</span><br><br><br>
        <%--提交和清除按钮框--%>
        <input type="button" value="返回" style="background: #CADEF6;float: right;width: 51px;height: 34px; margin-top: -37px;margin-right: 41px;" >
        <input type="button" value="提交" style="background: #CADEF6;float: right;width: 51px;height: 34px; margin-top: -37px;margin-right: 103px;" id="TQLBtn">
        <div class="container" style="width: 1100px;height: 497px;border: black solid 2px">
            <div style="width: 1080px;height: 27px;border: blue solid 1px;background: #58A7EC">
                <span style="color: white">主信息</span>
            </div>
            <div class="row">
                <div style="width: 500px;" class="col-md-6">
                    <table border="0px" >
                        <tr>
                            <td style="height: 30px;width:167px; text-align: right;background: #D0E4FC">编号</td>
                            <td><input id="idB" name="id" readonly></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;width:167px; text-align: right;background: #D0E4FC">产品编号</td>
                            <td><span id="productidB" name="productid" style="color: red"></span></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;width:167px; text-align: right;background: #D0E4FC"><span style="color: red">*</span>产品名称</td>
                            <td><input type="text" style="width: 203px;" id="productnameB" name="productname"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span style="color: red">*</span>I级分类</td>
                            <td>
                                <select style="width: 203px;" id="firstkindidB" name="firstkindid">
                                    <option value="">------------请选择-------------</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span style="color: red">*</span>III级分类</td>
                            <td>
                                <select style="width: 203px;" id="thirdkindidB" name="thirdkindid">
                                    <option value="">------------请选择-------------</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">用途类型</td>
                            <td>
                                <select style="width: 203px;">
                                    <option value="">------------请选择-------------</option>
                                    <option value="Y001-1" selected>商品</option>
                                    <option value="Y001-2">物料</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">计量单位</td>
                            <td><input type="text"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span class="glyphicon glyphicon-usd"></span><span style="color: red">*</span>市场单价(元)</td>
                            <td>
                                <input type="text" style="width: 203px;" id="listpriceB" name="listprice">
                            </td>
                        </tr>
                    </table>
                </div>
                <%--二--%>
                <div class="col-md-6">
                    <table border="0px" >
                        <tr>
                            <td style="height: 30px;width:167px; text-align: right;background: #D0E4FC">制造商</td>
                            <td><input type="text" style="width: 300px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span style="color: red">*</span>II级分类</td>
                            <td>
                                <select style="width: 203px;" id="secondkindidB" name="secondkindid">
                                    <option value="">------------请选择-------------</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">产品简称</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">档次级别</td>
                            <td>
                                <select style="width: 203px;">
                                    <option value="">------------请选择-------------</option>
                                    <option value="D001-1" selected>高档</option>
                                    <option value="D001-2">中档</option>
                                    <option value="D001-3">低档</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">计量值</td>
                            <td><input type="text"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span class="glyphicon glyphicon-usd"></span><span style="color: red">*</span>计划成本单价(元)</td>
                            <td>
                                <input type="text" style="width: 203px;" id="costpriceB" neme="costprice">
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div style="width: 1080px;height: 27px;border: blue solid 1px;background: #58A7EC">
                <span style="color: white">辅助信息</span>
            </div>

            <%--三和四个表格--%>
            <div class="row">
                <div style="width: 500px;" class="col-md-6">
                    <table border="0px" >
                        <tr>
                            <td style="height: 30px;width:167px; text-align: right;background: #D0E4FC">保修期</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">替代品编号</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">单位</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">供应商集合</td>
                            <td>
                                <textarea style="width: 302px;height: 77px;">

                                </textarea>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span class="glyphicon glyphicon-user"></span>登记人</td>
                            <td><input type="text" value="${username}" readonly></td>
                        </tr>
                    </table>
                </div>
                <%--四--%>
                <div class="col-md-6">
                    <table border="0px" >
                        <tr>
                            <td style="height: 30px;width:167px; text-align: right;background: #D0E4FC">替代品名称</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">生命周期(年)</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">产品经理</td>
                            <td><input type="text" style="width: 203px;"></td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC">产品描述</td>
                            <td>
                                <textarea style="width: 302px;height: 77px;">

                                </textarea>
                            </td>
                        </tr>
                        <tr>
                            <td style="height: 30px;text-align: right;background: #D0E4FC"><span class="glyphicon glyphicon-dashboard"></span>建档时间</td>
                            <td><input type="text" id="taobaoB" readonly></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
</form>
<script>

    $("#TQLBtn").click(function (){
        var datas=$("#myFormB").serializeArray();

        var file={};
        $(datas).each(function (index,item){
            file[item.name]=item.value;
        })
        $.ajax({
            url:"updateCheckTag.action",
            type:"post",
            data:JSON.stringify(file),
            contentType:"application/json",
            dataType:"json",
            success:function (data){
                alert(data.msg);
                $("#tab1").closeTabs("档案登记复核")
                $("#tab1").addTabs("产品档案登记复核","","audit.jsp","",true);
            }
        })
    })


    $(function (){
        //给一级分类下拉框赋值
        $.ajax({
            url:"queryFileSel.action",
            type:"post",
            dataType:"json",
            success:function (data){
                for(var i=0; i<data.length;i++){
                    var op=$("<option></option>")
                    op.val(data[i].firstkindid);
                    op.text(data[i].firstkindname);
                    $("#firstkindidB").append(op);
                    //给二级分类下拉框赋值
                    $.ajax({
                        url:"queryFileSel.action",
                        type:"post",
                        dataType:"json",
                        success:function (data){
                            for(var i=0; i<data.length;i++){
                                var op=$("<option></option>")
                                op.val(data[i].secondkindid);
                                op.text(data[i].secondkindname);
                                $("#secondkindidB").append(op);
                            }
                            //给三级分类下拉框赋值
                            $.ajax({
                                url:"queryFileSel.action",
                                type:"post",
                                dataType:"json",
                                success:function (data){
                                    for(var i=0; i<data.length;i++){
                                        var op=$("<option></option>")
                                        op.val(data[i].thirdkindid);
                                        op.text(data[i].thirdkindname);
                                        $("#thirdkindidB").append(op);
                                    }
                                    var id='${param.id}'
                                    $.ajax({
                                        url:"queryByFileL.action",
                                        data:{"id":id},
                                        type:"post",
                                        dataType:"json",
                                        success:function (data){
                                            console.log(data);
                                            $("#productidB").text(data.productid);
                                            $("#productnameB").val(data.productname);
                                            $("#firstkindidB").val(data.firstkindid);
                                            $("#thirdkindidB").val(data.thirdkindid);
                                            $("#listpriceB").val(data.listprice);
                                            $("#secondkindidB").val(data.secondkindid);
                                            $("#costpriceB").val(data.costprice);
                                            $("#idB").val(data.id);


                                        }
                                    })
                                }
                            })
                        }
                    })

                }
            }
        })

        $.get("queryCellByDate.action",function (data) {
            $("#taobaoB").val(data.datetime);
        },"json")
    })
</script>

</body>
</html>
